package cn.micro.system.manage.entity;
import cn.micro.system.manage.annotate.PrivacyEncrypt;
import cn.micro.system.manage.common.enums.PrivacyTypeEnum;
import cn.micro.system.manage.common.vaildate.ValidateGroup;
import cn.micro.system.manage.entity.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author wr
 * @since 2023-12-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysDimUser extends BaseEntity {

    private static final long serialVersionUID = 1L;


    /**
     * 用户名
     */
    @NotEmpty(message = "用户名不能为空",groups = ValidateGroup.add.class)
    private String username;

    /**
     * 密码
     */
    @NotEmpty(message = "密码不能为空",groups = ValidateGroup.add.class)
    private String password;

    /**
     * 姓名
     */
    @NotEmpty(message = "姓名不能为空",groups = ValidateGroup.add.class)
    private String name;

    /**
     * 手机
     */
    @NotEmpty(message = "手机不能为空",groups = ValidateGroup.add.class)
    @PrivacyEncrypt(type = PrivacyTypeEnum.MOBILE_PHONE)
    private String phone;

    /**
     * 邮箱
     */
    @NotEmpty(message = "邮箱不能为空",groups = ValidateGroup.add.class)
    @PrivacyEncrypt(type = PrivacyTypeEnum.EMAIL)
    private String email;

    /**
     * 头像地址
     */
    private String avatarUrl;

    /**
     * 部门id
     */
    private String deptId;

    /**
     * 岗位id
     */
    private String positionId;

    /**
     * 描述
     */
    private String description;

    /**
     * 状态（1：正常 0：停用）
     */
    @Range(min = 0, max = 1, message = "状态值不正确",groups = {ValidateGroup.add.class,ValidateGroup.edit.class})
    private Integer status;

    /**
     * 角色id列表
     */
    @TableField(exist = false)
    private List<String> roleIds;

    @TableField(exist = false)
    private List<SysDimRole> roleList;
    //岗位
    @TableField(exist = false)
    private String postName;
    //部门
    @TableField(exist = false)
    private String deptName;

    public static final String ID = "id";

    public static final String USERNAME = "username";

    public static final String PASSWORD = "password";

    public static final String NAME = "name";

    public static final String PHONE = "phone";

    public static final String EMAIL = "email";

    public static final String AVATAR_URL = "avatar_url";

    public static final String DEPT_ID = "dept_id";

    public static final String POSITION_ID = "position_id";

    public static final String DESCRIPTION = "description";

    public static final String STATUS = "status";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATE_TIME = "update_time";

    public static final String IS_DELETED = "is_deleted";

}
